package cn.hzy.admin.core;

import cn.hzy.admin.core.filter.FilterHandlerInterceptor;
import cn.hzy.admin.services.system.ISysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * <p>
 * 请求 过滤器
 * </p>
 *
 * @author hzy
 * @since 2020-04-26
 */
@Configuration
public class HzyWebMvcConfigurer implements WebMvcConfigurer {

    private final ISysUserService sysUserService;

    public HzyWebMvcConfigurer(ISysUserService sysUserService) {
        this.sysUserService = sysUserService;
    }

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new FilterHandlerInterceptor(sysUserService)).addPathPatterns("/**");
    }
}
